﻿package mortal.game.view.combinedServer.rank
{
    import com.mui.containers.globalVariable.*;
    import com.mui.controls.*;
    import fl.data.*;
    import mortal.common.global.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.resource.*;
    import mortal.game.view.combinedServer.data.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class CombinedSerRechRank extends GSprite
    {
        protected var _mbg:GImageBitmap;
        protected var _listTitle:CombinedSerReRankTitle;
        protected var _list1:GTileList;
        protected var _list2:GTileList;
        protected var _timeTxt:GTextFiled;

        public function CombinedSerRechRank()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._mbg = UIFactory.gImageBitmap(ImagesConst.CombinedSerRankBg, 0, 0, this);
            this._list1 = UIFactory.tileList(7, 226, 345, 330, this);
            this._list1.direction = GBoxDirection.VERTICAL;
            this._list1.verticalGap = 0;
            this._list1.horizontalGap = 2;
            this._list1.rowHeight = 33;
            this._list1.columnWidth = 330;
            this._list1.columnCount = 1;
            this._list1.rowCount = 10;
            this._list1.width = 345;
            this._list1.setStyle("cellRenderer", CombinedSerReRankCell1);
            this._list2 = UIFactory.tileList(364, 193, 318, 363, this);
            this._list2.direction = GBoxDirection.VERTICAL;
            this._list2.verticalGap = 0;
            this._list2.horizontalGap = 2;
            this._list2.rowHeight = 121;
            this._list2.columnWidth = 303;
            this._list2.columnCount = 1;
            this._list2.rowCount = 3;
            this._list2.width = 318;
            this._list2.setStyle("cellRenderer", CombinedSerReRankCell2);
            this._timeTxt = UIFactory.gTextField("2015年", 105, 162, 430, 20, this, GlobalStyle.textFormatPutong.setColor(16777215));
            this._listTitle = UIFactory.getUICompoment(CombinedSerReRankTitle, 8, 196, this);
            this.updateRuleAndTime();
            this.updateRwInfo();
            Dispatcher.dispatchEvent(new DataEvent(CombinedSerEvent.CombinedSerReqRankInfo));
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._listTitle.dispose(param1);
            this._listTitle = null;
            this._mbg = null;
            this._list1 = null;
            this._list2 = null;
            this._timeTxt = null;
            super.disposeImpl(param1);
            return;
        }// end function

        public function updateRankInfo() : void
        {
            var _loc_1:* = Cache.instance.combinedSer.rankList;
            var _loc_2:* = new DataProvider(_loc_1);
            this._list1.dataProvider = _loc_2;
            this._list1.drawNow();
            return;
        }// end function

        private function updateRwInfo() : void
        {
            var _loc_1:* = CombinedSerUtil.rankGiftArr;
            _loc_1 = this.genArr(_loc_1);
            var _loc_2:* = new DataProvider(_loc_1);
            this._list2.dataProvider = _loc_2;
            this._list2.drawNow();
            return;
        }// end function

        private function genArr(param1:Array) : Array
        {
            var _loc_4:Object = null;
            var _loc_2:Array = [];
            var _loc_3:int = 0;
            while (_loc_3 < param1.length)
            {
                
                _loc_4 = {};
                _loc_4.num = param1[_loc_3];
                _loc_2.push(_loc_4);
                _loc_3++;
            }
            return _loc_2;
        }// end function

        private function updateRuleAndTime() : void
        {
            this._timeTxt.text = "" + CombinedSerUtil.getOpenTimeStr();
            return;
        }// end function

    }
}
